<template>
    <div style="display: flex;">
        <Card title="查看历史" dis-hover icon="md-document" style="flex: 1;">
            <Row type="flex" justify="start" align="bottom">
                <!-- <Col style="margin-right: 40px;">
                <span style="margin-right: 10px;">属性模板名称</span>
                <Input style="width: auto;" v-model="name" placeholder="请输入属性模板名称"></Input>
                </Col>
                <Col>
                <Button type="primary" style="margin-right: 10px;" @click="linkAttributeBt('1')">查询</Button>
                <Button @click="linkAttributeBt('0')">清空</Button>
                </Col> -->
            </Row>
            <Table :columns="baseTableColumns" :data="baseTableData" style="margin-top: 20px;"
                @on-select="handleBaseTablaeSelect($event,'1')" @on-select-all="handleSelectAll($event,'1')"
                @on-select-all-cancel="handleSelectAllCancel($event,'1')">
                <template slot-scope="{ row }" slot="isKey">
                    <span v-if="row.isKey==='1'">是</span>
                    <span v-if="row.isKey==='2'">否</span>
                </template>
                <template slot-scope="{ row }" slot="isPriceSensitive">
                    <span v-if="row.isPriceSensitive==='1'">是</span>
                    <span v-if="row.isPriceSensitive==='2'">否</span>
                </template>
                <template slot-scope="{ row }" slot="isMetal">
                    <span v-if="row.isMetal==='1'">是</span>
                    <span v-if="row.isMetal==='2'">否</span>
                </template>
                <template slot-scope="{ row }" slot="state">
                    <span v-if="row.state==='1'">启用</span>
                    <span v-if="row.state==='2'">未启用</span>
                </template>
                <template slot-scope="{ row, index }" slot="action">
                </template>
            </Table>
            <div class="ivu-mt ivu-text-center">
                <Button @click="handleReset">返回</Button>
                <!-- <Page :total="totalNum" show-total show-sizer :current.sync="nowPage"
                    @on-change="initData" @on-page-size-change="handleChangePage" /> -->
            </div>
        </Card>
    </div>
</template>
<script>
import {
  mapState,
  mapMutations
} from 'vuex';
import util from '@/libs/util';
import bus from '@/mixins/bus';
import { ApiRequest } from '@api/basePage';
export default {
  components: {
  },
  data () {
    return {
      totalNum: 0,
      nowPage: 1,
      pageShow: 10, // 每页展示条数
      baseTableData: [],
      baseTableColumns: [
        {
          title: '品类编号',
          key: 'categoryNo',
          align: 'center',
          minWidth: 100
        },
        {
          title: '品类名称',
          key: 'categoryName',
          align: 'center',
          minWidth: 140
        },
        {
          title: '父分类',
          key: 'parentUuidStr',
          align: 'center',
          minWidth: 140
        },
        {
          title: '是否限制类商品',
          slot: 'isKey',
          align: 'center',
          minWidth: 140
        },
        {
          title: '是否价格敏感',
          slot: 'isPriceSensitive',
          align: 'center',
          minWidth: 120
        },
        {
          title: '是否金属制品',
          slot: 'isMetal',
          align: 'center',
          minWidth: 120
        },
        {
          title: '启用状态',
          slot: 'state',
          align: 'center',
          minWidth: 100
        },
        {
          title: '操作时间',
          key: 'opeTime',
          align: 'center',
          minWidth: 170
        },
        {
          title: '操作人',
          key: 'operName',
          align: 'center',
          minWidth: 100
        },
      ],
    }
  },
  watch: {
    '$route': function () {
      this.$nextTick(() => {
        this.$router.go(0);
      })
    }
  },
  created () {
    this.getConfigData();
  },
  mounted () { },
  methods: {
    // 全选
    handleSelectAll (row, type) {
    },
    // 取消全选
    handleSelectAllCancel (row, type) {
    },
    // 单独选择操作
    handleBaseTablaeSelect (row, type) {
    },
    // 获取初始配置信息
    getConfigData () {
      this.pagePath = this.$route.path;
      let dynamicData = require('./configjs/categoryAdd').default;
      this.requestApi = dynamicData.requestApi; // 页面所需接口集合
      this.$set(this.$data, 'dynamicData', dynamicData);
      this.uuid = this.$route.query.uuid;
      this.initData();
    },
    // 初始化数的数据
    initData () {
      let data = {}
      // 创建分类
      ApiRequest(this.requestApi.getHisListByUuid.url + '?uuid=' + this.uuid,
        this.requestApi.getHisListByUuid.type, data, true).then(res => {
        if (res.retStatus === '1') {
          this.baseTableData = res.retData;
        }
      })
    },
    handleChangePage (val) {
      this.pageShow = val
      this.$nextTick(() => {
        this.initData()
      })
    },
    handleReset () {
      this.$router.go(-1);
    },
  }
}
</script>
<style lang="less" scoped>
    .qw-kuang {}
</style>
